Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/github] add workflow run event trace handling #37578

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

adrielp
Copy link
Contributor

@adrielp adrielp commented Jan 29, 2025

Description

Adds functionality for creating a deterministic trace id and root span id coming from the workflow runs.

Link to tracking issue

Relates to #34944

Testing

Added tests and deployed locally.

Documentation

Updated the README to contain information about tracing.

@adrielp adrielp marked this pull request as ready for review February 3, 2025 01:32
@adrielp adrielp requested a review from a team as a code owner February 3, 2025 01:32
Copy link
Member

@crobert-1 crobert-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just nits, looks good overall 👍

return
}
return
// TODO: Enable when handleWorkflowJob is implemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any issue we can link to here for tracking?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original GitHub receiver issue was auto closed due to staleness + having the GitHub scraping portion reach alpha stability since that was the original scope. Right now the only issue I have tracking this work is over in the SemConv CICD project. Would that work or would you rather I open a new issue in the Contrib space?

receiver/githubreceiver/README.md Show resolved Hide resolved
receiver/githubreceiver/README.md Show resolved Hide resolved
receiver/githubreceiver/README.md Show resolved Hide resolved
receiver/githubreceiver/README.md Show resolved Hide resolved

traceID, err := newTraceID(e.GetWorkflowRun().GetID(), e.GetWorkflowRun().GetRunAttempt())
if err != nil {
gtr.logger.Sugar().Errorf("Failed to generate trace ID", zap.String("error", fmt.Sprint(err)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these error messages conform to standard error message requirements? (Referring here to the capitalization of "Failed")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'll fix

// newTraceID creates a deterministic Trace ID based on the provided
// inputs of runID and runAttempt.
func newTraceID(runID int64, runAttempt int) (pcommon.TraceID, error) {
// Original implementation appended `t` to TraceId's and `s` to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Original implementation appended `t` to TraceId's and `s` to
// Original implementation appended `t` to TraceIds and `s` to

w.WriteHeader(http.StatusOK)
return
default:
gtr.logger.Sugar().Debugf("event type not supported", zap.String("event_type", eventType))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the log level be a bit higher since this is an error, or is this an acceptable/expected problem that users usually don't care about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little torn on this one. Happy to get a second opinion. In the current state, this would trigger if the GitHub App (or repo webhook) was configured to send more than just workflow_{run, job} events. If it was emitted as an error, it could quickly clutter up the logs. The only thing to do would be to unsubscribe from those events.

On the http.error response, the only way someone is actually going to see that is If they opened up the GitHub app and looked at the last three days of event history. It's probably the right thing to do, but not that useful imo.

The only good alternative I can think of is setting:

I do have plans to in the future had event transformation natively in there for other events, but that's not a soon problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants